package day0920;

import java.util.Collection;
import java.util.Iterator;
import java.util.Set;
import java.util.TreeMap;

public class T2 {
    public static void main(String[] args) {
        TreeMap<Integer,String>  ss=new TreeMap();
        ss.put(1,"张三");//1.
        ss.put(2,"李四");

        Collection<String> c=ss.values();//values()获取所有的value  ["张三","李四"]
        Iterator<String> ite=c.iterator();//A. c的iterator();
        while(ite.hasNext()){//B
            String val=ite.next();//C.
            System.out.println("val = " + val);
        }








        Set<Integer> set=ss.keySet();//2.  keySet()获取所有key打印 [1 ,2 ]
        Iterator  ite2 =set.iterator();//A.  set集合.iterator()
        while(ite2.hasNext()){//B.
            Integer inte=(Integer) ite2.next();//C. ite的
            System.out.println("inte = " + inte);
        }
    }
}
